import { v4 as uuidv4 } from 'uuid'

export const getUUID = () => {
    //先从本地获取uuid是否有
    let uuid_token = localStorage.getItem('UUIDTOKEN')
    //如果没有
    if (!uuid_token) {
        //生成游客临时身份
        uuid_token = uuidv4();
        localStorage.setItem('UUIDTOKEN', uuid_token)
    }

    //返回id，没有return 再返回的是undefined
    return uuid_token;
}